package fr.ants.controller.command;

import fr.ants.view.panel.NestPanel;

/**
 * apply the modification on the nest.
 */
public class ApplyNestCommand implements Command {

	/**
	 * to have the parameter of the nest.
	 */
	private final NestPanel nestPanel;

	/**
	 * Build.
	 * 
	 * @param nestPanel
	 *            to have the parameter of the nest.
	 */
	public ApplyNestCommand(final NestPanel nestPanel) {
		this.nestPanel = nestPanel;
	}

	@Override
	public void execute() {
		if (nestPanel.getNest() != null) {
			nestPanel.getNest().setInitialAntLifespan(
					nestPanel.getInitialAntLifespanSliderPanelValue());
			nestPanel.getNest().setPheromoneMaxQty(
					nestPanel.getPheromoneSliderPanelValue());
			nestPanel.getNest().setMaxNestSize(nestPanel.getMaxNestSizeValue());
			nestPanel.getNest().setQueenQtyPerSwarm(
					nestPanel.getQueenQtyPerSwarmValue());
			nestPanel.getNest().setDelayBetweenSwarms(
					nestPanel.getDelayBetweenSwarmsValue());
			nestPanel.setEnabledButtonApply(false);
		}

	}

}
